<template>
    <div class="comment-item">
        <div class="user-img">
            <img :src="`./imgs/users/${comment.userImg}`" />
        </div>
        <div class="user-info">
            <div class="user-name">
                <span>用户名称</span>
                <!-- <div class="film-source">
                    <span class="star-img open"></span>
                    <span class="star-img open"></span>
                    <span class="star-img open"></span>
                    <span class="star-img close"></span>
                    <span class="star-img close"></span>
                    <span class="star-source">7.9</span>
                </div>-->
                <div class="film-source" v-if="comment.userSource">
                    <span class="star-img" v-for="c in 5" :class=" Math.ceil(comment.userSource)>=c?'open':'close' " :key="c"></span>
                    <span class="star-source">{{ comment.userSource*1 | addZero(1) }}</span>
                </div>
                <div class="film-source" v-if="!comment.userSource">
                    <span class="star-tip">暂无评分</span>
                </div>
            </div>
            <div class="user-time">{{ comment.createTime }}</div>
        </div>
        <div class="user-conent">{{ comment.userMsg }}</div>
    </div>
</template>

<script>
export default {
    props: {
        comment: {
            type: Object,
            default() {
                return {};
            }
        }
    }
};
</script>

<style lang="less" scoped>
.comment-item {
    display: grid;
    grid-template-columns: 1fr 6fr;
    grid-template-rows: auto auto;
    padding: 0rem 0.2rem 0.6rem 0.2rem;
    > .user-img {
        width: 100%;
        > img {
            width: 100%;
            height: auto;
            border-radius: 50%;
        }
    }
    > .user-info {
        font-size: 0.3rem;
        padding-left: 0.2rem;
        > .user-name {
            margin-top: 0.1rem;
            > .film-source {
                float: right;
            }
        }
        > .user-time {
            margin-top: 0.1rem;
            font-size: 0.26rem;
            color: @gray;
        }
    }
    > .user-conent {
        font-size: 0.24rem;
        text-indent: 0.56rem;
        line-height: 0.4rem;
        grid-column-start: 2;
        grid-column-end: 3;
        padding-left: 0.2rem;
    }
}
</style>